<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 内容主体区域 -->
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>销售名单</legend>
        </fieldset>
        <div class="layui-form">
            <table class="layui-table">
                <colgroup>
                    <col width="150">
                    <col width="150">
                    <col width="200">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>人物</th>
                    <th>手机号</th>
                    <th>审核状态</th>
                    <th>所属物业id</th>
                    <th>编辑</th>
                </tr>
                </thead>
                <tbody>
                @foreach($list as $v)
                    <tr>
                        <td>{{$v->sale_user}}</td>
                        <td>{{$v->sale_tel}}</td>
                        <td>{{$v->sale_status==0?"未审核":"已审核"}}</td>
                        <td>{{$v->property_id}}</td>
                        <td>
                            <input type="hidden" id="_token" name="_token" value="{{ csrf_token() }}">
                            <button class="layui-btn layui-btn-xs" onclick="sale_status({{$v->sale_status}},{{$v->sale_id}})">{{$v->sale_status==0?"需审核":"已审核"}}</button>
                        </td>

                    </tr>
                @endforeach

                </tbody>
            </table>
        </div>



    </div>
</div>
<script src="/layui/layui.js"></script>
<script src="/js/jq.js"></script>
<script>
function sale_status(s_status,s_id) {
    var _token = $('#_token').val();
    var data = new FormData();
    data.append('sale_status',s_status);
    data.append('sale_id',s_id);
    data.append('_token',_token);
    $.ajax({
        type:"post",
        url:"{{url('/admin/review_res')}}",
        data:data,
        cache: false,
        processData: false,
        contentType: false,
        success:function(msg){
            if(msg==1){
                window.location.href = 'http://www.cucurbit.com/index/review';//登录成功跳转
            }else{
                window.location.href = 'http://www.cucurbit.com/index/review';//登录成功跳转
            }
        },
    });
}
</script>
</body>
</html>